<#assign pageTitle="我的学习记录"/>
<#assign pageHeader>
    <link rel="stylesheet" type="text/css" href="/static/h5/css/user.css?20220210"/>
    <style>
        .user-course-list{
            background-color: #ffffff;
        }
        hr{
           color: #c0c4cc;
           border-style:dotted;
        }
    </style>
</#assign>
<#assign pageContent>
    <van-nav-bar
            title="我的学习记录"
            left-text="返回"
            left-arrow
            @click-left="location.href='/user/index.html';"
            fixed
            placeholder
    ></van-nav-bar>
    <div class="main-item mt-12">
        <#if courseStudyHistories?? && courseStudyHistories?size gt 0>
                <div class="course-card">
                    <#list courseStudyHistories as item>
                        <van-row gutter="24">
                            <van-col span="24">
                                    <div class="user-course-list">
                                        <span class="fl">${item.nodeName!}</span>
                                        <span class="fl">${item.updateTime!}</span>
                                        <van-button class="fr" type="primary" @click="toPlay(${item.nodeId})" size="small">继续学习</van-button>
                                    </div>
                                <hr size=1>
                            </van-col>
                        </van-row>
                    </#list>
                </div>
            <#else>
                <van-empty description="您还没有学习过课程..."></van-empty>
                <div style="padding: 0 12px"><van-button  type="info" size="large" v-if="pageCount != 0" url="/user/course/list.html">开始学习</van-button></div>
        </#if>
    </div>
    <van-pagination v-if="pageCount != 0"  v-model="currentPage" :page-count="pageCount" mode="simple"  class="mb-12 pd-12" @change="pageChange"></van-pagination>
</#assign>
<#assign pageScript>
    <script>
        var pageCount = ${totalPages}
        var currentPage = ${page.currentPage}
        new Vue({
            el: '#app',
            data() {
                return {
                    showFooter: false,
                    pageCount : pageCount,
                    currentPage: currentPage
                }
            },
            methods: {
                pageChange(value) {
                    window.location.href = '/user/study/list.html?page=' + value;
                },
                toPlay(nodeId){
                    window.location.href = '/user/course/play.html?nodeId=' + nodeId;
                }
            }
        })
    </script>
</#assign>
<#include "../layout_h5.ftl" />